/* Register all widgets, sounds, and variables */
<<include "Widgets">>\
<<include "Audio Files">>\
<<include "Stats Setup">>\
<<dialog "There is a bowl of fruit on the table.">>\
<<set $fruitTaken to "none">>\
<div class="dialogue">This is dialogue.</div>\
<<set $inventory to []>>\
<<set $hasNecklace to true>>
<<script>>console.log("hello")<</script>>
<<addclass "body" "phonebooth">>
<<elk "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.">>
<i class="fa-solid fa-book-journal-whills"></i>
/* <<audio "phonering" loop volume 0.5 play>> */
<<nobr>><div class="menubutton redbutton">[[Take an apple.|Grab a fruit.][$inventory.push("apple")]]</div>
<div class="menubutton yellowbutton">[[Take a banana.|Grab a fruit.][$inventory.push("banana")]]</div>
<div class="menubutton greenbutton">[[Take a pear.|Grab a fruit.][$inventory.push("pear")]]</div><</nobr>>
<<button "Take an apple." "Grab a fruit.">><</button>>
[[Javascipt Practice]]
<div id="phonebutton">[[Answer the Phone]]</div>You grab a $inventory[0] from the bowl.
<<script>>console.log('Player grabs a fruit')<</script>>
<<if $inventory[0] is "apple" and $testing>>It's a Granny Smith apple.<<elseif $inventory[0] is "banana">>It's a little over-ripe.<<elseif $inventory[0] is "pear">>It still has the sticker on it.<</if>>
Would you like to eat the $inventory[0]?
<<set $inventory.push("blueberry", "watermelon")>>
<div class="menubutton redbutton">[[YES]]</div>
[[NO]]
<<widget "elk">>\
<<audio "typewriter" loop volume 0.25 play>>\
<div id="dialogbox">\
<div id="textarea">\
<<set _keystroke to 50>><<set _keystroketime to (_keystroke + "ms")>>\
<div id="speech"><<set $typedtext to $args[0]>><<set $totaltime to ($typedtext.length * _keystroke)>><<type _keystroketime skipkey " ">>$typedtext<</type>></div>
<div id="charactername">— Elk</div>\
</div>\
</div>\
<<set _delay to (($totaltime * 1.25) + "ms")>>\
<<timed _delay>><<audio "typewriter" stop>><</timed>>
<</widget>>\
\
<<widget "dialog">><div class="dialogue">$args[0]</div>\<</widget>>\
<<script>>console.log('Loaded Widgets')<</script>>
<<widget "background">><<addclass "body" $args[0]>><</widget>>Double-click this passage to edit it.Double-click this passage to edit it.[[Inventory]]
[[Options]]<div id="inventories">\
<div id="inventoryGrid">\
<<for _i to 0; _i lt $inventory.length; _i++>>\
<div class="inventoryItem">''$inventory[_i]''</div>\
<</for>>\
<<if $inventory.length lt 9>><<for _k to 0; _k lt (9 - $inventory.length); _k++>>\
<div class="inventoryItem"></div>\
<</for>><</if>>\
</div>
<div id="inventoryGrid">\
<div class="inventoryItem"><<if $hasNecklace>>Necklace<<else>>???<</if>></div>\
<div class="inventoryItem">???</div>\
<div class="inventoryItem">???</div>\
<div class="inventoryItem">???</div>\
<div class="inventoryItem">???</div>\
<div class="inventoryItem">???</div>\
<div class="inventoryItem">???</div>\
<div class="inventoryItem">???</div>\
<div class="inventoryItem">???</div>\
</div>
</div>
<div id="muteButton">\
<<button "Mute">>\
<<masteraudio mute>>\
<<toggleclass "#unmuteButton" "hidden">>\
<<toggleclass "#muteButton" "hidden">>\
<</button>>\
</div>\
\
\
<div class="hidden" id="unmuteButton">\
<<button "Unmute">>\
<<masteraudio unmute>>\
<<toggleclass "#unmuteButton" "hidden">>\
<<toggleclass "#muteButton" "hidden">>\
<</button>>\
</div>\
<<return>>
<<set $playerHP to 100>>\
<<set $playerSanity to 100>>\
<<set $playerSpeed to 50>>\
<<set $combatPhase to "playerTurn">>\
<<set $playerAction to "attack">>\
<<set $enemyHP to 100>>\
<<set $enemySanity to 100>>\
<<set $enemySpeed to 50>>\
<<set $monsterBonus to 0>>\
<<set $allies to []>>\
<<set $potentialAllies to ["Sybil"]>>\
<<set $muted to false>>\
\
\
<!-- Audio Setup -->\
<<switch $combatPhase>>\
<<case "playerTurn">>
<<include "PlayerTurn">>
<<case "playerAct">>
<<include "PlayerAct">>
<<case "alliesAct">>
<<include "AlliesAct">>
<<case "enemyTurn">>
<<set $enemyAction to "attack">>
<<set $combatPhase to "enemyAct">>
<<include "Combat">>
<<case "enemyAct">>
<<if $enemyAction is "attack">>The monster attacks you!<<set $playerHP to ($playerHP - (5 + $monsterBonus))>><</if>>
<<set $combatPhase to "playerTurn">>
<<if $playerHP lte 0>>You black out![[Continue|Player Lose]]<<else>><<include "Combat">><</if>>
<<default>>
Default! $combatPhase
<</switch>><<set $allies to []>>You win!<<set $allies to []>>You lose!<<if (random(4) gt 1) and ($potentialAllies.length gt 0)>>
<<set $recruitedAlly to ($potentialAllies.random())>><<set $allies.push($recruitedAlly)>>You shout for help! $recruitedAlly answers your call!
The monster gets angry, but $recruitedAlly prevents it from doing more damage.
<<else>>You shout for help! But no one answers... The monster gets angry!<<set $monsterBonus to ($monsterBonus + 1)>><</if>><<if $allies.length is 0>>You have no allies.<<else>>Your ally attacks!<<set $enemyHP to ($enemyHP - 5)>><</if>>
<<set $combatPhase to "enemyTurn">>
<<include "Combat">> A monster attacks! What do you do?
<div class="menubutton redbutton">[[Attack.|Combat][$combatPhase to "playerAct";$playerAction to "attack"]]</div>
<<if ($playerAction isnot "shout") and ($allies.length lt $potentialAllies.length)>><div class="menubutton redbutton">[[Shout.|Combat][$combatPhase to "playerAct";$playerAction to "shout"]]</div><</if>><<if $playerAction is "attack">>You attack the monster!<<set $enemyHP to ($enemyHP - 10)>><<elseif $playerAction is "shout">><<include "Shout">><</if>>
<<set $combatPhase to "alliesAct">>
<<if $enemyHP lte 0>>You defeat the monster![[Continue|Player Win]]<<else>><<include "Combat">><</if>> <<background "bluebg">>
<<audio "phonering" stop>>
<<audio "typewriter" stop>>
<<button "Play">><<addclass "button" "expand">><</button>>
[[Start]] <<button "Test">><<script>>changeSquare();<</script>><</button>>
<div id="TestSquare"></div>
<div id="animatedSquare"></div><<cacheaudio "phonering" "https://hoopsnakecreative.neocities.org/PhoneRinging.wav">>
<<cacheaudio "typewriter" "https://hoopsnakecreative.neocities.org/typewriter.mp3">>
<<script>>console.log('Loaded Audio')<</script>><<return>>Double-click this passage to edit it.Double-click this passage to edit it.Double-click this passage to edit it.